﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using MoneyLover.WCFMoneyLover;

namespace MoneyLover.Pages
{
    public partial class SoChiTieu : PhoneApplicationPage
    {
        public SoChiTieu()
        {
            InitializeComponent();
        }
        MoneyLoverServiceClient _db = new MoneyLoverServiceClient();
        private void Loadreference()
        {
            _db.GetThuCompleted += _db_GetThuCompleted;
            _db.GetThuAsync(Contanst._tkdangnhap.USERNAME);
            _db.GetChiCompleted += _db_GetChiCompleted;
            _db.GetChiAsync(Contanst._tkdangnhap.USERNAME);
        }

        void _db_GetChiCompleted(object sender, GetChiCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                listchi.ItemsSource = e.Result;
            }
        }

        void _db_GetThuCompleted(object sender, GetThuCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                listthu.ItemsSource = e.Result;
            }
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            Loadreference();
        }
    }
}